package main

import (
	"fmt"
	"test/queue"
	job2 "test/queue/job"
)

func main() {
	// 生产者
	product()

	// 消费者
	consumer()
}

func product() {
	// 队列信息：指定消费者
	job := job2.NewJobOneQueue()
	job.Data = []int{1, 2, 3, 4, 5}
	// 抛队列
	product := queue.Product{}
	err := product.Send(job, job.QueueName)
	if err != nil {
		fmt.Printf("错误：%v", err)
	}
}

func consumer() {
	consumer := queue.Consumer{}
	job := job2.NewJobOneQueue()
	consumer.Run(job)

	job = job2.NewJobTwoQueue()
	consumer.Run(job)
}
